package com.zzr.zzrbackend.controller;


import com.zzr.zzrbackend.pojo.dto.CommonResult;
import com.zzr.zzrbackend.pojo.dto.param.*;
import com.zzr.zzrbackend.pojo.dto.result.*;
import com.zzr.zzrbackend.service.HomeInterfaceService;
import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletRequest;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;



@RestController
public class HomeInterfaceController {

    @Resource
    HomeInterfaceService homeInterfaceService;

    @PostMapping("/api/home-interface")
    public CommonResult<InterfaceResult> childHome(@Validated @RequestBody InterfaceParam interfaceParam){
        return homeInterfaceService.childHome(interfaceParam);
    }

    @PostMapping("/api/home-interface/list")
    public CommonResult<HomeListResult> childList(@Validated @RequestBody HomeListParam homeListParam){
        return homeInterfaceService.childList(homeListParam);
    }

    @PostMapping("/api/home-interface/text")
    public CommonResult<BookTextResult> bookText(@Validated @RequestBody BookTextParam bookTextParam){
        return homeInterfaceService.bookText(bookTextParam);
    }

    @PostMapping("/api/home-interface/story-detail")
    public CommonResult<BookTextResult> bookDetail(@Validated @RequestBody HomeListParam homeListParam) {
        return homeInterfaceService.bookDetail(homeListParam);
    }

    @PostMapping("/api/home-interface/play")
    public CommonResult<BookPlayResult> bookPlay(@Validated @RequestBody BookPlayParam bookPlayParam) {
        return homeInterfaceService.bookPlay(bookPlayParam);
    }

    @RequestMapping(value = "/api/home/parent", method = RequestMethod.GET)
    public CommonResult<HomeInformationResult> getHomeInformation(HttpServletRequest request) {
        return homeInterfaceService.getHomeInformation(request);
    }
    @PostMapping("/api/recommend-book")
    public CommonResult<InterfaceResult> recommendBook(HttpServletRequest request){
        return homeInterfaceService.recommendBook(request);
    }

    @PostMapping("/api/set-score")
    public CommonResult<NoData> setScore(@Validated @RequestBody SetScoreParam setScoreParam){
        return homeInterfaceService.setScore(setScoreParam);
    }

    @PostMapping("/api/is-evaluation")
    public CommonResult<IsEvaluationResult> isEvaluation(){
        return homeInterfaceService.isEvaluation();
    }
}
